using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DasBlogNewsGatorPlugin
{
	/// <summary>
	/// Summary description for Config.
	/// </summary>
	public class Config : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtWeblogName;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtUsername;
		private System.Windows.Forms.TextBox txtPassword;
		private System.Windows.Forms.Button btnOk;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox txtMediaTemplate;
		private System.Windows.Forms.CheckBox chkIncludeMedia;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Config()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.txtWeblogName = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.txtUsername = new System.Windows.Forms.TextBox();
			this.txtPassword = new System.Windows.Forms.TextBox();
			this.btnOk = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.label5 = new System.Windows.Forms.Label();
			this.txtMediaTemplate = new System.Windows.Forms.TextBox();
			this.chkIncludeMedia = new System.Windows.Forms.CheckBox();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "Weblog URL:";
			// 
			// txtWeblogName
			// 
			this.txtWeblogName.Location = new System.Drawing.Point(96, 21);
			this.txtWeblogName.Name = "txtWeblogName";
			this.txtWeblogName.Size = new System.Drawing.Size(168, 20);
			this.txtWeblogName.TabIndex = 1;
			this.txtWeblogName.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 56);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(64, 23);
			this.label3.TabIndex = 2;
			this.label3.Text = "Username:";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(16, 88);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(64, 23);
			this.label4.TabIndex = 4;
			this.label4.Text = "Password:";
			// 
			// txtUsername
			// 
			this.txtUsername.Location = new System.Drawing.Point(96, 53);
			this.txtUsername.Name = "txtUsername";
			this.txtUsername.TabIndex = 3;
			this.txtUsername.Text = "";
			// 
			// txtPassword
			// 
			this.txtPassword.Location = new System.Drawing.Point(96, 85);
			this.txtPassword.Name = "txtPassword";
			this.txtPassword.PasswordChar = '*';
			this.txtPassword.TabIndex = 5;
			this.txtPassword.Text = "";
			// 
			// btnOk
			// 
			this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.btnOk.Location = new System.Drawing.Point(69, 192);
			this.btnOk.Name = "btnOk";
			this.btnOk.TabIndex = 9;
			this.btnOk.Text = "OK";
			this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnCancel.Location = new System.Drawing.Point(149, 192);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.TabIndex = 10;
			this.btnCancel.Text = "Cancel";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(30, 152);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(56, 23);
			this.label5.TabIndex = 7;
			this.label5.Text = "Template:";
			// 
			// txtMediaTemplate
			// 
			this.txtMediaTemplate.Location = new System.Drawing.Point(94, 149);
			this.txtMediaTemplate.Name = "txtMediaTemplate";
			this.txtMediaTemplate.Size = new System.Drawing.Size(184, 20);
			this.txtMediaTemplate.TabIndex = 8;
			this.txtMediaTemplate.Text = "";
			// 
			// chkIncludeMedia
			// 
			this.chkIncludeMedia.Location = new System.Drawing.Point(14, 120);
			this.chkIncludeMedia.Name = "chkIncludeMedia";
			this.chkIncludeMedia.Size = new System.Drawing.Size(240, 24);
			this.chkIncludeMedia.TabIndex = 6;
			this.chkIncludeMedia.Text = "Include \"Now Playing\" line from WMP9";
			this.chkIncludeMedia.CheckedChanged += new System.EventHandler(this.chkIncludeMedia_CheckedChanged);
			// 
			// Config
			// 
			this.AcceptButton = this.btnOk;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CancelButton = this.btnCancel;
			this.ClientSize = new System.Drawing.Size(292, 224);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.txtMediaTemplate);
			this.Controls.Add(this.chkIncludeMedia);
			this.Controls.Add(this.btnOk);
			this.Controls.Add(this.txtPassword);
			this.Controls.Add(this.txtUsername);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.txtWeblogName);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnCancel);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Config";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "Config";
			this.Load += new System.EventHandler(this.Config_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void Config_Load(object sender, System.EventArgs e)
		{
			txtWeblogName.Text = ConfigInfo.WeblogUrl;
			txtUsername.Text = ConfigInfo.Username;
			txtPassword.Text = ConfigInfo.Password;
			chkIncludeMedia.Checked = ConfigInfo.IncludeMedia;
			txtMediaTemplate.Text = ConfigInfo.MediaTemplate;
			txtMediaTemplate.Enabled = ConfigInfo.IncludeMedia;
		}

		private void btnOk_Click(object sender, System.EventArgs e)
		{
			ConfigInfo.WeblogUrl = txtWeblogName.Text;
			ConfigInfo.Username = txtUsername.Text;
			ConfigInfo.Password = txtPassword.Text;
			ConfigInfo.IncludeMedia = chkIncludeMedia.Checked;
			ConfigInfo.MediaTemplate = txtMediaTemplate.Text;
		}

		private void chkIncludeMedia_CheckedChanged(object sender, System.EventArgs e)
		{
			txtMediaTemplate.Enabled = chkIncludeMedia.Checked;
		}
	}
}
